﻿using gt.UserInfo.DomainModels.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace gt.UserInfo.DomainModels.Respository
{
    public interface IRepository<TEntity, TKey>
        where TEntity : class, IEntity<TKey>, new()
    {
        #region "Basic CRUD"

        Task<TKey> CreateAsync(TEntity entity);
        Task CreateOrUpdateAsync(TEntity enties);

        Task CreateAsync(IList<TEntity> enties);

        //IList<TEntity> GetList(string defaultOrder = "Id Asc");
        //DataPager<TEntity> GetList(int pageIndex, int pageSize, string defaultOrder = "Id Asc");

        Task<TEntity> GetAsync(TKey key);

        //IQueryable<TEntity> QueryAll(Expression<Func<TEntity, bool>> predicate);

        Task UpdateAsync(TEntity entity);
        Task UpdateAsync(IList<TEntity> entities);

        Task DeleteAsync(TEntity entity);
        Task DeleteAsync(TKey key);

        #endregion
    }
}
